import { IsString, IsEnum, IsNumber, Min, IsDateString } from 'class-validator';
import { ApiProperty } from '@nestjs/swagger';

export class CreateCouponDto {
  @ApiProperty({ description: '优惠券名称', maxLength: 64 })
  @IsString()
  name: string;

  @ApiProperty({ description: '类型', enum: ['cash', 'discount'] })
  @IsEnum(['cash', 'discount'])
  type: 'cash' | 'discount';

  @ApiProperty({ description: '面额/折扣', example: 10 })
  @IsNumber()
  @Min(0.01)
  amount: number;

  @ApiProperty({ description: '使用门槛', example: 100 })
  @IsNumber()
  @Min(0)
  threshold: number;

  @ApiProperty({ description: '有效期起', type: String, format: 'date-time' })
  @IsDateString()
  validFrom: string;

  @ApiProperty({ description: '有效期止', type: String, format: 'date-time' })
  @IsDateString()
  validTo: string;
} 